import { toggleCollect } from "@/api";
import { PetCardType } from "@/pages/Index/components/HotList";
import { Toast } from "react-vant";
export const toggleCollectFunc = async (id: number, did: number, callback: Function, li: PetCardType[]) => {
    const { data: message } = (await toggleCollect(id, did)) as { data: string };
    Toast.info(message);
    callback(
        li.map((item) => {
            if (item.id === did) {
                item.collect = !item.collect;
            }
            return item;
        })
    );
}